﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PEAnalyzer.ModeView.PEInfoPage
{
    internal class PEInfoModeView : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        private string m_strFileName;

        private string m_strFullPath;

        private string m_strInfo;

        private ObservableCollection<SectionHeaderViewItem> m_SectionHeaderList = new ObservableCollection<SectionHeaderViewItem>();

        private ObservableCollection<ExportFunctionModeView> m_ExportFunctionList = new ObservableCollection<ExportFunctionModeView>();

        private ObservableCollection<ImportModuleItem> m_ImportModuleList = new ObservableCollection<ImportModuleItem>();

        private ObservableCollection<ImportFunctionItem> m_ImportFunctionList = new ObservableCollection<ImportFunctionItem>();

        private ObservableCollection<HeaderValueModeView> m_HeaderValueList = new ObservableCollection<HeaderValueModeView>();

        private UInt32 m_uExportTableAddress; 
        public UInt32 ExportTableAddress
        {
            get => m_uExportTableAddress;
            set
            {
                m_uExportTableAddress = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ExportTableAddress"));
            }
        }

        private UInt32 m_uExportTableSize;
        public UInt32 ExportTableSize
        {
            get => m_uExportTableSize;
            set
            {
                m_uExportTableSize = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ExportTableSize"));
            }
        }

        private UInt32 m_uImportTableAddress;
        public UInt32 ImportTableAddress
        {
            get => m_uImportTableAddress;
            set
            {
                m_uImportTableAddress = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ImportTableAddress"));
            }
        }

        private UInt32 m_uImportTableSize;
        public UInt32 ImportTableSize
        {
            get => m_uImportTableSize;
            set
            {
                m_uImportTableSize = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ImportTableSize"));
            }
        }

        private UInt32 m_uResourceTableAddress;
        public UInt32 ResourceTableAddress
        {
            get => m_uResourceTableAddress;
            set
            {
                m_uResourceTableAddress = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ResourceTableAddress"));
            }
        }

        private UInt32 m_uResourceTableSize;
        public UInt32 ResourceTableSize
        {
            get => m_uResourceTableSize;
            set
            {
                m_uResourceTableSize = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ResourceTableSize"));
            }
        }

        private UInt32 m_uExceptionTableAddress;
        public UInt32 ExceptionTableAddress
        {
            get => m_uExceptionTableAddress;
            set
            {
                m_uExceptionTableAddress = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ExceptionTableAddress"));
            }
        }

        private UInt32 m_uExceptionTableSize;
        public UInt32 ExceptionTableSize
        {
            get => m_uExceptionTableSize;
            set
            {
                m_uExceptionTableSize = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ExceptionTableSize"));
            }
        }

        private UInt32 m_uSecurityTableAddress;
        public UInt32 SecurityTableAddress
        {
            get => m_uSecurityTableAddress;
            set
            {
                m_uSecurityTableAddress = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("SecurityTableAddress"));
            }
        }

        private UInt32 m_uSecurityTableSize;
        public UInt32 SecurityTableSize
        {
            get => m_uSecurityTableSize;
            set
            {
                m_uSecurityTableSize = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("SecurityTableSize"));
            }
        }

        private UInt32 m_uBaseRelocationTableAddress;
        public UInt32 BaseRelocationTableAddress
        {
            get => m_uBaseRelocationTableAddress;
            set
            {
                m_uBaseRelocationTableAddress = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("BaseRelocationTableAddress"));
            }
        }

        private UInt32 m_uBaseRelocationTableSize;
        public UInt32 BaseRelocationTableSize
        {
            get => m_uBaseRelocationTableSize;
            set
            {
                m_uBaseRelocationTableSize = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("BaseRelocationTableSize"));
            }
        }

        private UInt32 m_uDebugTableAddress;
        public UInt32 DebugTableAddress
        {
            get => m_uDebugTableAddress;
            set
            {
                m_uDebugTableAddress = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("DebugTableAddress"));
            }
        }

        private UInt32 m_uDebugTableSize;
        public UInt32 DebugTableSize
        {
            get => m_uDebugTableSize;
            set
            {
                m_uDebugTableSize = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("DebugTableSize"));
            }
        }

        private UInt32 m_uCopyrightTableAddress;
        public UInt32 CopyrightTableAddress
        {
            get => m_uCopyrightTableAddress;
            set
            {
                m_uCopyrightTableAddress = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("CopyrightTableAddress"));
            }

        }

        private UInt32 m_uCopyrightTableSize;
        public UInt32 CopyrightTableSize
        {
            get => m_uCopyrightTableSize;
            set
            {
                m_uCopyrightTableSize = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("CopyrightTableSize"));
            }
        }

        private UInt32 m_uGlobalTableAddress;
        public UInt32 GlobalPtrTableAddress
        {
            get => m_uGlobalTableAddress;
            set
            {
                m_uGlobalTableAddress = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("GlobalTableAddress"));
            }
        }

        private UInt32 m_uGlobalTableSize;
        public UInt32 GlobalPtrTableSize
        {
            get => m_uGlobalTableSize;
            set
            {
                m_uGlobalTableSize = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("GlobalTableSize"));
            }
        }

        private UInt32 m_uThreadLocalStorageTableAddress;
        public UInt32 ThreadLocalStorageTableAddress
        {
            get => m_uThreadLocalStorageTableAddress;
            set
            {
                m_uThreadLocalStorageTableAddress = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ThreadLocalStorage"));
            }
        }

        private UInt32 m_uThreadLocalStorageTableSize;
        public UInt32 ThreadLocalStorageTableSize
        {
            get => m_uThreadLocalStorageTableSize;
            set
            {
                m_uThreadLocalStorageTableSize = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ThreadLocalStorageTableSize"));
            }
        }

        private UInt32 m_uLoadConfigurationTableAddress;
        public UInt32 LoadConfigurationTableAddress
        {
            get => m_uLoadConfigurationTableAddress;
            set
            {
                m_uLoadConfigurationTableAddress = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("LoadConfigurationTableAddress"));
            }
        }

        private UInt32 m_uLoadConfigurationTableSize;
        public UInt32 LoadConfigurationTableSize
        {
            get => m_uLoadConfigurationTableSize;
            set
            {
                m_uLoadConfigurationTableSize = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("LoadConfigurationTableSize"));
            }
        }

        private UInt32 m_uBoundImportTableAddress;
        public UInt32 BoundImportTableAddress
        {
            get => m_uBoundImportTableAddress;
            set
            {
                m_uBoundImportTableAddress = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("BoundImportTableAddress"));
            }
        }

        private UInt32 m_uBoundImportTableSize;
        public UInt32 BoundImportTableSize
        {
            get => m_uBoundImportTableSize;
            set
            {
                m_uBoundImportTableSize = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("BoundImportTableSize"));
            }
        }

        private UInt32 m_uImportAddressTableAddress;
        public UInt32 ImportAddressTableAddress
        {
            get => m_uImportAddressTableAddress;
            set
            {
                m_uImportAddressTableAddress = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ImportAddressTableAddress"));
            }

        }

        private UInt32 m_uImportAddressTableSize;
        public UInt32 ImportAddressTableSize
        {
            get => m_uImportAddressTableSize;
            set
            {
                m_uImportAddressTableSize = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ImportAddressTableSize"));
            }
        }

        private UInt32 m_uDelayImportTableAddress;
        public UInt32 DelayImportTableAddress
        {
            get => m_uDelayImportTableAddress;
            set
            {
                m_uDelayImportTableAddress = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("DelayImportTableAddress"));
            }
        }

        private UInt32 m_uDelayImportTableSize;
        public UInt32 DelayImportTableSize
        {
            get => m_uDelayImportTableSize;
            set
            {
                m_uDelayImportTableSize = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("DelayImportTableSize"));
            }
        }

        private UInt32 m_uCOMDecriptorTableAddress;
        public UInt32 COMDecriptorTableAddress
        {
            get => m_uCOMDecriptorTableAddress;
            set
            {
                m_uCOMDecriptorTableAddress = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("COMDecriptorTableAddress"));
            }
        }

        private UInt32 m_uCOMDecriptorTableSize;
        

        public UInt32 COMDecriptorTableSize
        {
            get => m_uCOMDecriptorTableSize;
            set
            {
                m_uCOMDecriptorTableSize = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("COMDecriptorTableSize"));
            }
        }

        public string FileName
        {
            get => m_strFileName;
            set
            {
                m_strFileName = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("FileName"));
            }
        }

        public string FullPath
        {
            get => m_strFullPath;
            set
            {
                m_strFullPath = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("FullPath"));
            }
        }

        public string Info
        {
            get => m_strInfo;

            set
            {
                m_strInfo = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Info"));
            }
        }

        public ObservableCollection<SectionHeaderViewItem> SectionHeaderItems
        {
            get => m_SectionHeaderList;

            set
            {
                m_SectionHeaderList = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("SectionHeaderList"));
            }
        }

        public ObservableCollection<ExportFunctionModeView> ExportFunctions
        {
            get => m_ExportFunctionList;
            set
            {
                m_ExportFunctionList = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ExportFunctions"));
            }

        }

        public ObservableCollection<ImportFunctionItem> ImportFunctions
        {
            get => m_ImportFunctionList;
            set
            {
                m_ImportFunctionList = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ImportFunctions"));
            }
        }

        public ObservableCollection<ImportModuleItem> ImportModules
        {
            get => m_ImportModuleList;
            set
            {
                m_ImportModuleList = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ImportModules"));
            }
        }

        public ObservableCollection<HeaderValueModeView> HeaderValues
        {
            get => m_HeaderValueList;
            set
            {
                m_HeaderValueList = value;
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("HeaderValues"));
            }
        }
    }
}
